<style type="text/css">
    .center-table{
        text-align: center;
        vertical-align: middle!important;
    }
    .spec-label{
        display:block;width: 50px;height: 50px;
        background-image: url("https://dss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=1906469856,4113625838&fm=26&gp=0.jpg");
        background-size: 50px 50px;
        background-repeat: no-repeat;
    }
</style>
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    {if $admin_id==1 || $admin_id==7}
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Sort')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-sort" data-rule="required" class="form-control" name="row[sort]" type="number" value="9999">
        </div>
    </div>
    {/if}
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Thumbnailimage')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-thumbnailimage" data-rule="required" class="form-control" size="50" name="row[thumbnailimage]" type="text">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="plupload-thumbnailimage" class="btn btn-danger plupload" data-input-id="c-thumbnailimage" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-thumbnailimage"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-thumbnailimage" class="btn btn-primary fachoose" data-input-id="c-thumbnailimage" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-thumbnailimage"></span>
            </div>
            <ul class="row list-inline plupload-preview" id="p-thumbnailimage"></ul>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Thumbnailimages')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-thumbnailimages" data-rule="required" class="form-control" size="50" name="row[thumbnailimages]" type="text">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="plupload-thumbnailimages" class="btn btn-danger plupload" data-input-id="c-thumbnailimages" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="true" data-preview-id="p-thumbnailimages"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-thumbnailimages" class="btn btn-primary fachoose" data-input-id="c-thumbnailimages" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-thumbnailimages"></span>
            </div>
            <ul class="row list-inline plupload-preview" id="p-thumbnailimages"></ul>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">商品分类:</label>
        <div class="col-xs-12 col-sm-8">
            <select id="cid1" class="form-control" data-rule="required" name="row[cid1]" style="width: 30%;">
                <option value="">请选择</option>
                {foreach name="cateList" id="vo1"}
                <option value="{$vo1.id}">{$vo1.name}</option>
                {/foreach}
            </select>
            <select id="cid2" class="form-control" data-rule="required" name="row[cid2]" style="width: 30%;">
                <option value="">请选择</option>
            </select>
            <select id="cid3" class="form-control" data-rule="required" name="row[category_id]" style="width: 30%;">
                <option value="">请选择</option>
            </select>

        </div>
    </div>
    {if $admin_id==1 || $admin_id==7}
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Sell_virtual')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-sell_virtual" data-rule="required" class="form-control" name="row[sell_virtual]" type="number" value="0">
        </div>
    </div>
    {/if}

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Goodscontent')}:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="c-goodscontent" class="form-control editor" rows="5" name="row[goodscontent]" cols="50"></textarea>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">商品规格:</label>
        <div class="col-xs-12 col-sm-8">
            <dl class="fieldlist spec-list">
                <dd><a href="javascript:;" class="btn btn-sm btn-success spec-add"><i class="fa fa-plus"></i> {:__('Append')}</a></dd>
            </dl>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">规格表格:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="specTable">
                <!--规格表-->
            </div>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">批量设置:</label>
        <div class="col-xs-12 col-sm-8">
            <table class="table table-bordered">
                <thead>
                <tr>
                    <th>爆款价：
                        <input type="number" step="0.01" class="form-control" id="batch-price">
                        <button type="button" class="btn btn-sm btn-primary" onclick="batchSet(1,0)">设置</button>
                        <button type="button" class="btn btn-sm btn-success" onclick="batchSet(1,1)">变更</button>
                    </th>
<!--                    <th>市场价：-->
<!--                        <input type="number" step="0.01" class="form-control" id="batch-price1">-->
<!--                        <button type="button" class="btn btn-sm btn-primary" onclick="batchSet(4,0)">设置</button>-->
<!--                        <button type="button" class="btn btn-sm btn-success" onclick="batchSet(4,1)">变更</button>-->
<!--                    </th>-->
                    <th>重量：
                        <input type="number" step="0.01" class="form-control" id="batch-weight">
                        <button type="button" class="btn btn-sm btn-primary" onclick="batchSet(3,0)">设置</button>
                        <button type="button" class="btn btn-sm btn-success" onclick="batchSet(3,1)">变更</button>
                    </th>
                    <th>库存：
                        <input type="number" class="form-control" id="batch-stock">
                        <button type="button" class="btn btn-sm btn-primary" onclick="batchSet(2,0)">设置</button>
                        <button type="button" class="btn btn-sm btn-success" onclick="batchSet(2,1)">变更</button>
                    </th>
                </tr>
                </thead>
            </table>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Is_ship')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="radio">
                {foreach name="isShipList" item="vo"}
                <label for="row[is_ship]-{$key}">
                    <input id="row[is_ship]-{$key}" name="row[is_ship]" type="radio" class="select-radio" value="{$key}" {in name="key" value="0"}checked{/in} /> {$vo}
                </label>
                {/foreach}
            </div>
        </div>
    </div>
    <div class="form-group is_show_file" style="display:none;">
        <label class="control-label col-xs-12 col-sm-2">{:__('Freight_id')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-freight_id"  data-source="logistics/index" class="form-control selectpage" name="row[freight_id]" type="text" value="">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('是否上架')}:</label>
        <div class="col-xs-12 col-sm-8">

            <select  id="c-state" data-rule="required" class="form-control selectpicker" name="row[state]">
                {foreach name="stateList" item="vo"}
                <option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>
                {/foreach}
            </select>

        </div>
    </div>
    {if $admin_id==1 || $admin_id==7}
<!--    <div class="form-group">-->
<!--        <label class="control-label col-xs-12 col-sm-2">{:__('Is_recommond')}:</label>-->
<!--        <div class="col-xs-12 col-sm-8">-->
<!--            <div class="radio">-->
<!--                {foreach name="isRecommondList" item="vo"}-->
<!--                <label for="row[isRecommondList]-{$key}"><input id="row[isRecommondList]-{$key}" name="row[is_recommond]" type="radio" value="{$key}" {in name="key" value="0"}checked{/in} /> {$vo}</label>-->
<!--                {/foreach}-->
<!--            </div>-->
<!--        </div>-->
<!--    </div>-->







    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('审核状态')}:</label>
        <div class="col-xs-12 col-sm-8">

            <select  id="c-status" data-rule="required" class="form-control " name="row[status]">
                {foreach name="statusList" item="vo"}
                <option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>
                {/foreach}
            </select>

        </div>
    </div>
    {/if}
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>


</form>
<script src="__CDN__/assets/js/jquery-1.11.0.js"></script>
<script src="__CDN__/assets/js/backend/goodssku.js?rand=123"></script>

<script>
    $(function() {
        $(".select-radio").click(function(){
            var radio=   $('.select-radio:checked').val();
            if (radio==0){
                $(".is_show_file").attr("style","display:none;");//隐藏div
            }else {
                $(".is_show_file").attr("style","display:block;");//显示div
            }
        })
    });
    //执行一个laydate实例
    laydate.render({
        elem: '.test1', //指定元素
        elem: '.test2' //指定元素
    });
</script>
<script type="text/javascript">
    $('#cid1').change(function () {
        //获取select选中 并清除 cid2 cid3中的参数
        $('#cid2').empty();
        $('#cid3').empty();
        $('#cid2').append('<option value="">请选择</option>');
        $('#cid3').append('<option value="">请选择</option>');
        //获取二级分类
        var pid = $('#cid1 :selected').val();
        if(pid > 0){
            $.ajax({
                url:"{:url('admin/goods1/getcateList')}",
                data:{pid:pid},
                type:'post',
                dataType:'json',
                success:function (res) {
                    if(res.code == 1){
                        $('#cid2').append(res.data);
                    }
                }
            })
        }

    });
    $('#cid2').change(function () {
        //获取select选中 并清除 cid2 cid3中的参数
        $('#cid3').empty();
        $('#cid3').append('<option value="">请选择</option>');
        //获取二级分类
        var pid = $('#cid2 :selected').val();
        if(pid > 0){
            $.ajax({
                url:"{:url('admin/goods1/getcateList')}",
                data:{pid:pid},
                type:'post',
                dataType:'json',
                success:function (res) {
                    if(res.code == 1){
                        $('#cid3').append(res.data);
                    }
                }
            })
        }

    })

    $(".type_type").click(function(){
        var radio=   $('.type_type:checked').val();
        if (radio==0){
            $(".endtime").attr("style","display:none;");//隐藏div
            $(".starttime").attr("style","display:none;");//隐藏div
        }else if(radio==3){
            $(".endtime").attr("style","display:none;");//隐藏div
            $(".starttime").attr("style","display:none;");//隐藏div
        }else {
            $(".endtime").attr("style","display:block;");//显示div
            $(".starttime").attr("style","display:block;");//显示div
        }
    })
</script>